<template>
    <div>
        <!--    遍历图片列表进行展示,绑定鼠标点击事件changeImg,修改infoContent.images[idx]的idx的值    -->
        <img  v-for="(item,index) in infoContent.images" :key='index' :src="item.imgUrl" @click="changeImg(index)" alt="">
        <p class="cur">
            <!--      放大显示的图片      -->
            <img :src="infoContent.images[idx].imgUrl" alt="">
        </p>
        <!--    型号信息    -->
        <p class="detail">
            <span>{{infoContent.productColor}}</span> <span>{{infoContent.productSize}}</span>
        </p>
    </div>
</template>

<script>
    export default {
        props:['infoContent'],
        data(){
            return {
                idx: 0
            }
        },
        methods:{
            /* 在鼠标点击时,将数组的下标传递过去,进行放大显示 */
            changeImg(idx) {
                this.idx = idx; 
            }
        }
    }
</script>

<style scoped>
    img{
        width: 60px;
        margin-right: 10px;
        cursor: pointer;
    }
    .cur img{
        width: 300px;
    }
    .detail{
        font-size: 12px;
        color: #aaa;
    }
</style>